package com.service.cook.imp;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dao.cook.CdishDaoY;
import com.po.Dish;
import com.service.cook.CdishServiceY;

@Service
public class CdishServiceImpY implements CdishServiceY{
	@Resource(name="cdishDaoImpY")
	private CdishDaoY cdishDao; 
	@Override
	public Dish findDishOne(String dish_id) {
		Dish dish=cdishDao.findDishOne(dish_id);
		return dish;
	}
	@Override
	public List<Dish> findDishByName(String dish_name) {
		List<Dish> dish=cdishDao.findDishByName(dish_name);
		return dish;
	}
	@Override
	public List<Dish> getDishList() {
		List<Dish> dishlist=cdishDao.getDishList();
		return dishlist;
	}

	@Override
	public int addDish(Dish dish) {
		if(dish.getDish_imagepath()==null){
			dish.setDish_imagepath("1.jpg");
		}
		int i=cdishDao.addDish(dish);
		return i;
	}

	@Override
	public int delDish(String dish_id) {
		int i=cdishDao.delDish(dish_id);
		return i;
	}

	@Override
	public int updateDish(Dish dish) {
		int i=cdishDao.updateDish(dish);
		return i;
	}

}
